////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   ITEM_LINE
// AUTHOR           :   Alex Cheung
// DATE CREATE      :   2006/01/19
// DESCRIPTION      :   a FORM file for the function, ITEM_LINE
//                  :
//                  :
//                  :
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2006/01/19   Alex Cheung     1.0                 source is generated.
//
//
//
////////////////////////////////////////////////////////////////////////////////

package com.erp.app.catalog.itemLine.web;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.erp.app.util.web.ActionErrorUtil;
import com.erp.app.util.web.WebUtil;
import com.erp.framework.controller.form.SimplePageEditStyleForm;
import com.erp.framework.model.schema.TableSchema;
import com.erp.framework.util.CommonUtil;
import com.erp.framework.util.logger.Logger;

/**
* <p>A <strong>PageEditForm</strong> is a JavaBean which provides property
* getter and setter methods for all of the bean properties, and implements
* <code>Serializable</code>, as required by the JavaBean specification
* The main purpose for this bean is to get the user search criteria input
* and to get the user input from the web browsers.
* from the web browsers.
* As the name implies, it will only handle one-page-edit documents.
*
* @author          Alex Cheung
* @version 1.0     2006/01/19
* @since           FrameWork 1.0
*
*/
public class ItemLineForm extends SimplePageEditStyleForm {

    private String editItemLine;
    public String getEditItemLine() { return editItemLine; }
    public void setEditItemLine(String editItemLine) { this.editItemLine = editItemLine; }

    //Attributes (DB Table Name: T_ITEM_LINE)
    private String[] companyCode;                    //DB Column Name: COMPANY_CODE
    private String[] itemLine;                       //DB Column Name: ITEM_LINE
    private String[] itemLineDesc;                   //DB Column Name: ITEM_LINE_DESC
    private String[] status;                         //DB Column Name: STATUS
    private String[] dcInd;                          //DB Column Name: DC_IND
    private String[] dcDate;                         //DB Column Name: DC_DATE
    private String[] createUser;                     //DB Column Name: CREATE_USER
    private String[] createDate;                     //DB Column Name: CREATE_DATE
    private String[] updateUser;                     //DB Column Name: UPDATE_USER
    private String[] updateDate;                     //DB Column Name: UPDATE_DATE
    private String[] itemLineVoAction;
    private String[] browser;

    //Searching Criteria Attributes (DB Table Name: T_ITEM_LINE)
    private String srchCompanyCode;                  //DB Column Name: COMPANY_CODE
    private String srchStatus;                       //DB Column Name: STATUS
    private String srchItemLineFr;                   //DB Column Name: ITEM_LINE
    private String srchItemLineTo;                   //DB Column Name: ITEM_LINE
    private String srchItemLineDescFr;               //DB Column Name: ITEM_LINE_DESC
    private String srchItemLineDescTo;               //DB Column Name: ITEM_LINE_DESC

    /**
    * Converts to a string representing the data in this object.
    * A new <code>String</code> object is allocated and initialized to
    * contain the character sequence currently represented by this
    * object. This <code>String</code> is then returned. Subsequent
    * changes to this object do not affect the contents of the
    * <code>String</code>.
    *
    * @return     a string representation of the object.
    * @see        java.lang.Object#toString()
    * @author     Alex Cheung
    * @since      FrameWork 1.0
    */
    public String toString() {
        String pkStr = "PK: {srchItemLineFr = " + this.srchItemLineFr
            + "\n, srchItemLineTo = " + this.srchItemLineTo + "}\n";

        String colStr = "COL: {srchItemLineDescFr = " + this.srchItemLineDescFr
            + "\n, srchItemLineDescTo = " + this.srchItemLineDescTo + "}\n";

        String mandatoryStr = "{srchCompanyCode = " + this.srchCompanyCode
            + "\n, srchStatus = " + this.srchStatus
            + "}\n";

        return "toString() is:\n" + mandatoryStr + pkStr + colStr;
    }


    /**
    * Validate the properties that have been set for this non-HTTP request,
    * and return an <code>ActionErrors</code> object that encapsulates any
    * validation errors that have been found.  If no errors are found, return
    * <code>null</code> or an <code>ActionErrors</code> object with no
    * recorded error messages.
    * <p>
    * The default implementation attempts to forward to the HTTP version of
    * this method.
    *
    * @param      the action errors array
    * @author     Alex Cheung
    * @since      FrameWork 1.0
    */
    public void validateSearch(ActionErrors errors) {

        /*
        ArrayList rows = getMultiRows(0);

        for (int i = 0; rows != null && i < rows.size(); i++) {
            ItemLineRow row = (ItemLineRow) rows.get(i);

            if (CommonUtil.isEmpty(row.getShipDate())) {
                ActionErrorUtil.addErrorForGeneralFieldBlank(errors, "Ship Date");
            } else {
                if (!CommonUtil.isValidDate(row.getShipDate())) {
                    ActionErrorUtil.addErrorForInvalidDate(errors, "Ship Date");
                }
            }
        }
        */
    }

    /**
    * Validate the properties that have been set for this non-HTTP request,
    * and return an <code>ActionErrors</code> object that encapsulates any
    * validation errors that have been found.  If no errors are found, return
    * <code>null</code> or an <code>ActionErrors</code> object with no
    * recorded error messages.
    * <p>
    * The default implementation attempts to forward to the HTTP version of
    * this method.
    *
    * @param      mapping      the action mapping
    * @param      formIn       the action form
    * @param      request      the http request
    * @param      response     the http response
    * @param      errors       the action errors array
    * @author     Alex Cheung
    * @since      FrameWork 1.0
    */
    public void moreValidateSearch(ActionMapping mapping, ActionForm formIn,
        HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {


        try {

        } catch (Exception e) {
            Logger.logExceptions(this, e);
        }
    }

    /**
    * Reset all bean properties to their default state.  This method
    * is called inside the reset() method.
    *
    * @param      mapping The mapping used to select this instance
    * @param      request The servlet request we are processing
    * @author     Alex Cheung
    * @since      FrameWork 1.0
    */
    public void otherReset(ActionMapping mapping, HttpServletRequest request) {

        setRowMode(null);
        setIdx(null);
        //companyCode = null;
        //srchCompanyCode = null;
    }

    protected void otherValidate(ActionErrors errors) {
        ArrayList rows = getMultiRows();
        TableSchema ts = this.getTs();

        if (rows != null && rows.size() > 0) {
        	for (int i=0; i<rows.size(); i++) {
        		ItemLineRow row = (ItemLineRow) rows.get(i);

                if (row == null || !CommonUtil.isEmpty(row.getIsDelete())) 
                	continue;
            	if (CommonUtil.isEmpty(row.getItemLineDesc())) {
                    ActionErrorUtil.addErrorForGeneralFieldBlank(errors, ts.getDisplayWebLabelByObjectId("LBL_GRID_ITEM_LINE_DESC"));
                } else {
                    row.setItemLineDesc(row.getItemLineDesc().trim());
                }
        	}
        	
           /* for (int i=0; i<rows.size(); i++) {
                ItemLineRow row = (ItemLineRow) rows.get(i);

                if (row == null) continue;

                String rowItemLine = row.getItemLine();

                if (CommonUtil.isEmpty(rowItemLine)) {

                    ActionErrorUtil.addErrorForGeneralFieldBlank(errors, ts.getDisplayWebLabelByObjectId("LBL_GRID_ITEM_LINE"));
                } else {
                    row.setItemLine(rowItemLine.toUpperCase());
                }
                WebUtil.validateCode(row.getCompanyCode(), row.getTs().getDisplayWebLabelByObjectId("LBL_GRID_COMPANY_CODE"), errors);
                WebUtil.validateCode(row.getItemLine(), row.getTs().getDisplayWebLabelByObjectId("LBL_GRID_ITEM_LINE"), errors);
            }*/
        }
    }

    ////////////////////////////////////////////////////////////////////////////////
    //Generated Accessors (get/set methods) for Table (ItemLine)
    ////////////////////////////////////////////////////////////////////////////////

    public String[] getCompanyCode() {
        return this.companyCode;
    }

    public String[] getItemLine() {
        return this.itemLine;
    }

    public String[] getItemLineDesc() {
        return this.itemLineDesc;
    }

    public String[] getStatus() {
        return this.status;
    }

    public String[] getDcInd() {
        return this.dcInd;
    }

    public String[] getDcDate() {
        return this.dcDate;
    }

    public String[] getCreateUser() {
        return this.createUser;
    }

    public String[] getCreateDate() {
        return this.createDate;
    }

    public String[] getUpdateUser() {
        return this.updateUser;
    }

    public String[] getUpdateDate() {
        return this.updateDate;
    }

    public void setCompanyCode(String[] companyCode) {
        this.companyCode = companyCode;
    }

    public void setItemLine(String[] itemLine) {
        this.itemLine = itemLine;
    }

    public void setItemLineDesc(String[] itemLineDesc) {
        this.itemLineDesc = itemLineDesc;
    }

    public void setStatus(String[] status) {
        this.status = status;
    }

    public void setDcInd(String[] dcInd) {
        this.dcInd = dcInd;
    }

    public void setDcDate(String[] dcDate) {
        this.dcDate = dcDate;
    }

    public void setCreateUser(String[] createUser) {
        this.createUser = createUser;
    }

    public void setCreateDate(String[] createDate) {
        this.createDate = createDate;
    }

    public void setUpdateUser(String[] updateUser) {
        this.updateUser = updateUser;
    }

    public void setUpdateDate(String[] updateDate) {
        this.updateDate = updateDate;
    }

    ////////////////////////////////////////////////////////////////////////////////
    //Generated Accessors (get/set methods) for searching criterias
    ////////////////////////////////////////////////////////////////////////////////

    public String getSrchCompanyCode() {
        return this.srchCompanyCode;
    }

    public String getSrchStatus() {
        return this.srchStatus;
    }

    public String getSrchItemLineFr() {
        return this.srchItemLineFr;
    }

    public String getSrchItemLineTo() {
        return this.srchItemLineTo;
    }

    public String getSrchItemLineDescFr() {
        return this.srchItemLineDescFr;
    }

    public String getSrchItemLineDescTo() {
        return this.srchItemLineDescTo;
    }

    public void setSrchCompanyCode(String srchCompanyCode) {
        this.srchCompanyCode = srchCompanyCode;
    }

    public void setSrchStatus(String srchStatus) {
        this.srchStatus = srchStatus;
    }

    public void setSrchItemLineFr(String srchItemLineFr) {
        this.srchItemLineFr = srchItemLineFr;
    }

    public void setSrchItemLineTo(String srchItemLineTo) {
        this.srchItemLineTo = srchItemLineTo;
    }

    public void setSrchItemLineDescFr(String srchItemLineDescFr) {
        this.srchItemLineDescFr = srchItemLineDescFr;
    }

    public void setSrchItemLineDescTo(String srchItemLineDescTo) {
        this.srchItemLineDescTo = srchItemLineDescTo;
    }
	public String[] getItemLineVoAction() {
		return itemLineVoAction;
	}
	public void setItemLineVoAction(String[] itemLineVoAction) {
		this.itemLineVoAction = itemLineVoAction;
	}
	public String[] getBrowser() {
		return browser;
	}
	public void setBrowser(String[] browser) {
		this.browser = browser;
	}
	

    ////////////////////////////////////////////////////////////////////////////////
    //Other Accessors (get/set methods)
    ////////////////////////////////////////////////////////////////////////////////


}